/*
* created by Administrator on 2018/12/12
* 好的代码像粥一样,是得用时间和精力熬的。
*/
const app =(resolve)=>require(['@/App'],resolve);
const root = (resolve) => require(['@/root'], resolve);

const auth = (resolve) => require(['@pgcpt/auth'], resolve);
const register = (resolve) => require(['@cpt/register'], resolve);
const login = (resolve) => require(['@cpt/login'], resolve);

const resetPassword =(resolve)=>require(['@pgcpt/resetPassword'],resolve);
const addAddress=(resolve)=>require(['@pgcpt/addAddress'],resolve);
const ReceivingAddress=(resolve)=>require(['@pgcpt/ReceivingAddress'],resolve);

const personal=(resolve)=>require(['@pgcpt/personal'],resolve);
const loan=(resolve)=>require(['@pgcpt/loan'],resolve);

const Mall=(resolve)=>require(['@pgcpt/Mall'],resolve);
const Recommend=(resolve)=>require(['@cpt/Recommend'],resolve);
const Beauty=(resolve)=>require(['@cpt/Beauty'],resolve);
const general =(resolve)=>require(['@cpt/general'],resolve);
const wristwatch=(resolve)=>require(['@cpt/wristwatch'],resolve);
const furnishings=(resolve)=>require(['@cpt/furnishings'],resolve);
const bags=(resolve)=>require(['@cpt/bags'],resolve);
const parts=(resolve)=>require(['@cpt/parts'],resolve);
const Jewellery=(resolve)=>require(['@cpt/Jewellery'],resolve);
const phone=(resolve)=>require(['@cpt/phone'],resolve);

const commoditydetails=(resolve)=>require(['@pgcpt/commoditydetails'],resolve);

const timeSpike=(resolve)=>require(['@pgcpt/timeSpike'],resolve);
const timeSpikeStart=(resolve)=>require(['@cpt/timeSpikeStart'],resolve);
const timeSpikeSoon=(resolve)=>require(['@cpt/timeSpikeSoon'],resolve);

const repayment=(resolve)=>require(['@pgcpt/repayment'],resolve);
const shoppingCart=(resolve)=>require(['@pgcpt/shoppingCart'],resolve);
const notFound = (resolve) => require(['@pcpt/notfound'], resolve);
const routes = [
  {
    path: '/',
    name: 'app',
    redirect:'root',
    component: app,
    children:[{
      path:'root',
      name:'root',
      component:root,
      redirect:'root/personal',
      children: [
        {
          path: 'auth',
          name: 'auth',
          redirect:'auth/login',
          component: auth,
          children: [
            {
              path: 'register',
              name: 'register',
              component: register,
              meta:{
                leftText:'',
                title:'',
                rightText:'',
                go:'/root/personal'
              }
            },
            {
              path: 'login',
              name: 'login',
              component: login,
              meta:{
                leftText:'',
                title:'',
                right:'',
                go:'/root/personal'
              }
            }
          ]
        },
        {
          name:'resetPassword',
          path:'resetPassword',
          component:resetPassword
        },
        {
          name:'personal',
          path:'personal',
          component:personal,
        },
        {
          name:'loan',
          path:'loan',
          component:loan,
        },
        {
          name:'Mall',
          path:'Mall',
          component:Mall,
          redirect:'Mall/Recommend',
          children:[
            {
              name:'Recommend',
              path:'Recommend',
              component:Recommend,
            },
            {
              name:'Beauty',
              path:'Beauty',
              component:Beauty,
            },
            {
              name:'general',
              path:'general',
              component:general,
            },
            {
              name:'wristwatch',
              path:'wristwatch',
              component:wristwatch,
            },
            {
              name:'furnishings',
              path:'furnishings',
              component:furnishings,
            },
            {
              name:'bags',
              path:'bags',
              component:bags,
            },
            {
              name:'parts',
              path:'parts',
              component:parts,
            },
            {
              name:'Jewellery',
              path:'Jewellery',
              component:Jewellery,
            },
            {
              name:'phone',
              path:'phone',
              component:phone,
            },
          ]
        },
        {
          name:'timeSpike',
          path:'timeSpike',
          component:timeSpike,
          redirect:'timeSpike/timeSpikeStart',
          children:[
            {
              name:'timeSpikeStart',
              path:'timeSpikeStart',
              component:timeSpikeStart,
              meta:{
                title:'爆款秒杀',
                go:'/root/Mall/Recommend'
              }
            },
            {
              name:'timeSpikeSoon',
              path:'timeSpikeSoon',
              component:timeSpikeSoon,
              meta:{
                title:'爆款秒杀',
                go:'/root/Mall/Recommend'
              }
            }
            ],
        },
        {
          name:'commoditydetails',
          path:'commoditydetails',
          component:commoditydetails
        },
        {
          name:'repayment',
          path:'repayment',
          component:repayment,
        },
        {
          name:'shoppingCart',
          path:'shoppingCart',
          component:shoppingCart,
          meta:{
            title:'购物车',
            rightText: '编辑',
            go:''
          }
        },
        {
          name:'addAddress',
          path:'addAddress',
          component:addAddress,
          meta:{
            title:'新增收货地址',
            go:'/root/ReceivingAddress'
          }
        },
        {
          name:'ReceivingAddress',
          path:'ReceivingAddress',
          component:ReceivingAddress,
          meta:{
            title:'收货地址',
            go:'/root/personal'
          }
        }]
    }]
  },
  {
    path: '*',
    name: 'not-found',
    component: notFound
  }
];
export default routes;
